<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://shiro.apache.org/tags" prefix="shiro"%>
<%String path = request.getContextPath();%>
<script type="text/javascript">
function getRegionBy(aid,area) {
	if (area == "") return;
	$.ajax({cache:false, url:"ajax/ajaxGetArea.do", type:"post", dataType:"json", data:{area:area}, success:function(json){showRegioninfo(json,aid);}});
}
function showRegioninfo(json,aid) {
	var str = "";
	for (var i in json) {
		str += json[i].region + ",";
	}
	str = str.substring(0, str.length-1);
	var obj = document.getElementById(""+aid+"_div");
	obj.innerText = str;
	obj.title = str;
}
</script>

<form id="pagerForm" method="post" action="<%=path %>/affiche/listAffiche.action">
	<input type="hidden" name="pageRequest" value="1" />
	<input type="hidden" name="pageNum" value="${paginator.pageIndex}" />
	<input type="hidden" name="numPerPage" value="${paginator.pageSize}" />
</form>
<div class="pageHeader">
	<div class="searchBar">
		<form onsubmit="return navTabSearch(this);" rel="pagerForm" action="<%=path%>/affiche/listAffiche.action" method="post">
			<ul class="searchContent">
				<li>
					<label style="text-align: right;">编码：</label>
					<input type="text" name="afficheVO.uuid" value='<s:property value="afficheVO.uuid" />' />
				</li>
				<li>
					<label style="text-align: right;">标题：</label>
					<input type="text" name="afficheVO.title" value='<s:property value="afficheVO.title" />' />
				</li>
				<li>
					<label style="text-align: right;">渠道：</label>
					<select name="afficheVO.mode" class="combox">
						<option value="">所有渠道</option>
						<option value="0"${afficheVO.mode==0?" selected='true'":""}>WEB前台</option>
						<option value="1"${afficheVO.mode==1?" selected='true'":""}>APP客户端</option>
						<option value="2"${afficheVO.mode==2?" selected='true'":""}>WEB后台</option>
					</select>
				</li>
			</ul>
			<ul class="searchContent">
			<li style="width: 450px">
				<label style="text-align: right;">发布时间：</label>
				从<input type="text" name="afficheVO.startIssueDate" value="${afficheVO.startIssueDate}" dateFmt="yyyy-MM-dd HH:mm:ss" class="date param" readonly="false" size="19"/>
				到<input type="text" name="afficheVO.endIssueDate" value="${afficheVO.endIssueDate}" dateFmt="yyyy-MM-dd HH:mm:ss" class="date param" readonly="false" size="19"/>
			</li>
			</ul>
			<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
			</ul>
			</div>
		</form>
	</div>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<shiro:hasPermission name="addAffiche">
			<li><a class="add" href="<%=path%>/affiche/addAffiche.action" target="navTab"><span>添加</span></a></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="deleteAffiches">
			<li><a title="确实要删除这些记录吗?" target="selectedTodo" rel="ids" postType="string" href="<%=path%>/affiche/deleteAffiches.action" class="delete"><span>删除</span></a></li>
			</shiro:hasPermission>
		</ul>
	</div>
	<table class="table" style="width: auto;" layoutH="164">
		<thead>
			<tr>
				<th width="2%"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th width="10%">公告编码</th>
				<th width="6%">公告渠道</th>
				<th width="13%">标题</th>
				<th width="10%">简介</th>
				<th width="15%">显示区域</th>
				<th width="6%">公告内容</th>
				<th width="5%">添加者</th>
				<th width="10%">发布时间</th>
				<th width="7%">最后修改者</th>
				<th width="10%">最后修改时间</th>
				<th width="6%">操作</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="afficheList" id="affiche">
				<tr rel="<s:property value="id"/>">
					<td><input name="ids" value="<s:property value="id"/>" type="checkbox"></td>
					<td title="${uuid}"><s:property value="uuid" /></td>
					<td><s:if test="mode==0">WEB前台</s:if><s:elseif test="mode==1">客户端</s:elseif><s:else>WEB后台</s:else></td>
					<td title="${title}"><s:property value="title"/></td>
					<td title="${titleShow}"><s:property value="titleShow"/></td>
					<td><s:if test="bound==0">全部地区</s:if><s:else><div id="${id}_div"></div><script type="text/javascript">getRegionBy(${id},'${area}');</script></s:else></td>
		             <td><shiro:hasPermission name="previewAffiche"><a href="<%=path%>/affiche/previewAffiche.action?afficheVO.id=${id}" target="dialog" rel="afficheList" max="true" title="点击预览公告" width="800" height="480">预览内容</a></shiro:hasPermission></td>	
		             <td><s:property value="userVO.name" /></td>
		             <td><s:date format="yyyy-MM-dd HH:mm:ss" name="issueTime"/></td>
		             <td><s:property value="userUpdateVO.name" /></td>
		             <td><s:date format="yyyy-MM-dd HH:mm:ss" name="issueTimeUpdate"/></td>
					<td>
						<shiro:hasPermission name="deleteAffiche">
						<a title="确实要删除这条记录吗?" target="ajaxTodo" href="<%=path%>/affiche/deleteAffiche.action?ids=<s:property value="id" />" class="btnDel">删除</a>
						</shiro:hasPermission>
						<shiro:hasPermission name="editAffiche">
						<a title="编辑" target="navTab" href="<%=path%>/affiche/editAffiche.action?afficheVO.id=${id}" class="btnEdit">编辑</a>
						</shiro:hasPermission>
					</td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
				<span>显示</span>
				<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
					<option value="15" <c:if test="${paginator.pageSize==15}">selected='selected'</c:if> >15</option>
					<option value="30" <c:if test="${paginator.pageSize==30}">selected='selected'</c:if> >30</option>
					<option value="50" <c:if test="${paginator.pageSize==50}">selected='selected'</c:if> >50</option>
					<option value="100" <c:if test="${paginator.pageSize==100}">selected='selected'</c:if> >100</option>
					<option value="200" <c:if test="${paginator.pageSize==200}">selected='selected'</c:if> >200</option>
				</select>
				<span>条，共${paginator.totalCount}条</span>
			</div>
			<div class="pagination" targetType="navTab" totalCount="${paginator.totalCount}" 
				numPerPage="${paginator.pageSize}" pageNumShown="10" currentPage="${paginator.pageIndex}"></div>
	</div>
</div>